package cn.tedu.learn.tea.adapter.controller;

import cn.tedu.learn.tea.domain.service.PictureService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 图片Controller
 */
@Api(value = "picture", tags = "图片")
@Validated
@RestController
@RequestMapping("/picture")
@Slf4j
public class PictureController {

    @Autowired
    private PictureService pictureService;

    @ApiOperation("图片上传")
    @PostMapping("/fileUpload")
    public String fileUpload(MultipartFile file) {
        return pictureService.upload(file);
    }
}
